The answers to this section were entered as illustrated below. If you removed the percent signs from in front of the exercises that are commented out and compose this document again, you can see how the error messages work.
This example also illustrates the use of the exhead command, which allows you to insert instructions for doing the next several exercises.
\exercises \exera This the first exercise of section~\ref{seca}. \answer{This is the answer to the first exercise of section~\ref{seca}.} \exera This is the second exercise of section~\ref{seca}. \answer This is the answer to the second exercise of section~\ref{seca}. \exer This exercise has no answer. % \exera This exercise tests an error message. % It is marked to % have an answer, but does not. % \exer This exercise tests an error message too. % \answer This should not be here. \exhead{This header applies to Exercises~\ref{firste} through~\ref{laste}.} \exera\annot{hard}\label{firste} Yet another exercise with an answer. \answer This is yet another answer. It is longer than the others, and illustrates how you can have more than one paragraph.\par This is the second paragraph. \exer\annot{hard} This is an exercise with subexercises. \subexera First subexercise. \subanswer Answer to first subexercise. \subexer Second subexercise. \subexera Third subexercise. \subanswer Answer to third subexercise. \exer\label{laste}\immsubexera This is the first subexercise of an exercise that has no text before the subexercises. \immsubanswer This is an answer. \subexera Another subexercise. \subanswer Another answer. \exer\label{solans} This exercise has an answer in the Solution Manual. \solution Answer to Exercise~\ref{solans} on page~\pageref{solans}. \eexer
This the first exercise of section. This is the answer to the first exercise of section .
This is the second exercise of section . This is the answer to the second exercise of section .
This exercise has no answer.
This header applies to Exercises through .
hard Yet another exercise with an answer. This is yet another answer. It is longer than the others, and illustrates how you can have more than one paragraph.
This is the second paragraph.
hard This is an exercise with subexercises. First subexercise. Answer to first subexercise.
Second subexercise.
Third subexercise. Answer to third subexercise.
This is the first subexercise of an exercise that has no text before the subexercises. This is an answer.
Another subexercise. Another answer.
This exercise has an answer in the Solution Manual. Answer to Exercise on page .